
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link rel=stylesheet href='include/hoj.css' type='text/css'>
</head>
<body>
<center>
<div style="width:90%; text-align:left">
<img src="image/logo.png"/>
</div>
<table width=96%> 
	<tr align="center" class='hd' valign="top">
				<th><a href="faqs.php">F.A.Qs</a></th>
		<th><a href="./bbs.php">Web Board</a></th>
		<th><a href="./">Home</a></th>
		<th><a href="./problemset.html">ProblemSet</a></th>
		<th><a href="./status.php">Status</a></th>
		<th><a href="./ranklist.php">Ranklist</a></th>
		<th><a href="./contest.php">Contest</a></th>
		<th><a href=loginpage.php>Login</a></th><th><a href=registerpage.php>Register</a></th>	</tr>
</table>
</center>
<center>
<div class="notice">
	<div>
		<B>Notice:</B>鉴于种种原因，本OJ自下周星期一（3月5号）开始不再全面开放，请各位做好善后事宜，谢谢合作。	</div>
</div>
</center>
</div>
<title>Problem 2518. -- [Shoi2010]滚动的正四面体 -- 衡阳八中OJ离线版-2012-02-29</title><center><h2>2518: [Shoi2010]滚动的正四面体</h2><span class=green>Time Limit: </span>10 Sec&nbsp;&nbsp;<span class=green>Memory Limit: </span>128 MB<br><span class=green>Submit: </span>38&nbsp;&nbsp;<span class=green>Solved: </span>14<br>[<a href='submitpage.php?id=2518'>Submit</a>][<a href='problemstatus.php?id=2518'>Status</a>][<a href='bbs.php?id=2518'>Discuss</a>]</center><h2>Description</h2><div class=content><p class="MsoPlainText" style="margin: 6pt 0cm 12pt; text-indent: 21pt; line-height: 150%; mso-para-margin-top: .5gd; mso-para-margin-right: 0cm; mso-para-margin-bottom: 1.0gd; mso-para-margin-left: 0cm; mso-char-indent-count: 2.0"><font size="3"><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">正四面体总共有</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">4</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">个面，每个面都是一个正三角形。现在把它的一个面标记上字母</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">A</span><font face="宋体"><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">，如</span>图 <span lang="EN-US" style="mso-no-proof: yes">3</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">中所示，</span></font><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">A</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">标记在底面上：</font></span></font></p>
<p class="MsoPlainText" style="margin: 6pt 0cm 12pt; text-indent: 21pt; line-height: 150%; mso-para-margin-top: .5gd; mso-para-margin-right: 0cm; mso-para-margin-bottom: 1.0gd; mso-para-margin-left: 0cm; mso-char-indent-count: 2.0"><font size="3"><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体"><img height="129" alt="" width="129" src="/JudgeOnline/upload/201111/1(4).jpg" /></font></span></font></p>
<p></p>
<p></p>
<p class="MsoPlainText" style="margin: 6pt 0cm 12pt; text-indent: 21pt; line-height: 150%; mso-para-margin-top: .5gd; mso-para-margin-right: 0cm; mso-para-margin-bottom: 1.0gd; mso-para-margin-left: 0cm; mso-char-indent-count: 2.0"><font size="3"><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">于是，这个正四面体的滚动过程就可以用一个只包含&ldquo;</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">L</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">&rdquo;&ldquo;</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">R</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">&rdquo;&ldquo;</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">B</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">&rdquo;的字符串来描述。初始时，正四面体的</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">A</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">面朝下，现在</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">SECSA</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">将给这个正四面体一串滚动指令&mdash;&mdash;当然就是一个这样的字符串&mdash;&mdash;让这个正四面体每秒滚动一下。也就是说，第</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">1</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">秒内正四面体</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">A</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">面朝下，第</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">1</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">秒末执行第一条指令，第</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">2</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">秒末执行第</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">2</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">条指令，依次类推，直至将整个指令串执行完毕。</font></span></font></p>
<p class="MsoPlainText" style="margin: 6pt 0cm 12pt; text-indent: 21pt; line-height: 150%; mso-para-margin-top: .5gd; mso-para-margin-right: 0cm; mso-para-margin-bottom: 1.0gd; mso-para-margin-left: 0cm; mso-char-indent-count: 2.0"></p>
<p></p>
<p></p>
<p class="MsoPlainText" style="margin: 6pt 0cm 12pt; text-indent: 21pt; line-height: 150%; mso-para-margin-top: .5gd; mso-para-margin-right: 0cm; mso-para-margin-bottom: 1.0gd; mso-para-margin-left: 0cm; mso-char-indent-count: 2.0"><img alt="" src="/JudgeOnline/upload/201111/3(4).jpg" /></p>
<p></p>
<p class="MsoPlainText" style="margin: 6pt 0cm 12pt; text-indent: 21pt; line-height: 150%; mso-para-margin-top: .5gd; mso-para-margin-right: 0cm; mso-para-margin-bottom: 1.0gd; mso-para-margin-left: 0cm; mso-char-indent-count: 2.0"><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">你的任务就是当</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">SECSA</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">询问你的时候告诉他：这个正四面体在第</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">L</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">秒到第</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">R</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">秒内</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">A</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">面有多少秒朝着地面。当然，</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">SECSA</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">可能因为对这个正四面体的滚动路径不满意，他随时会修改他的某一条指令。因此你的程序应该能执行下面两个操作：</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;"><o:p></o:p></span></p>
<p class="MsoPlainText" style="margin: 6pt 0cm 12pt 64.5pt; text-indent: -36pt; line-height: 150%; mso-para-margin-top: .5gd; mso-para-margin-right: 0cm; mso-para-margin-bottom: 1.0gd; mso-para-margin-left: 64.5pt; mso-list: l0 level1 lfo1; tab-stops: list 64.5pt"><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;; mso-fareast-font-family: 'Times New Roman'"><span style="mso-list: Ignore">(1)<span style="font: 7pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">接受</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">SECSA</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">修个第</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">i</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">条指令的信息</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;"><o:p></o:p></span></p>
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt 64.5pt; text-indent: -36pt; line-height: 150%; mso-list: l0 level1 lfo1; tab-stops: list 64.5pt"><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;; mso-fareast-font-family: 'Times New Roman'"><span style="mso-list: Ignore">(2)<span style="font: 7pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">回答</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">SECSA</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">的&ldquo;在第</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">L</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">秒到第</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">R</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">秒内</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">A</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">面有多少秒朝着地面&rdquo;的询问</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;"><o:p></o:p></span></p>
<p class="MsoPlainText" style="margin: 6pt 0cm 12pt; text-indent: 21pt; line-height: 150%; mso-para-margin-top: .5gd; mso-para-margin-right: 0cm; mso-para-margin-bottom: 1.0gd; mso-para-margin-left: 0cm; mso-char-indent-count: 2.0"><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">例如，假如原指令串为&ldquo;</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">LLLLB</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">&rdquo;，那么第</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">1</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">、</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">4</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">、</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">6</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">秒内</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">A</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">面是朝下的。此时，如果</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">SECSA</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">向你询问第</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">3</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">秒到第</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">6</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">秒的情况，你就应该回答&ldquo;</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">2</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">&rdquo;。而</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">SECSA</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">将第</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">3</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">条指令修改为&ldquo;</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">R</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">&rdquo;的话，指令串就变成了&ldquo;</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">LLRLB</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">&rdquo;，那么正四面体就只有在第</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">1</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">、</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">5</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">秒内</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">A</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">面朝下了。如</span>图 <span lang="EN-US" style="mso-no-proof: yes">5</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">所示：</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;"><o:p></o:p></span></p>
<p class="MsoPlainText" style="margin: 6pt 0cm 12pt; text-indent: 21pt; line-height: 150%; mso-para-margin-top: .5gd; mso-para-margin-right: 0cm; mso-para-margin-bottom: 1.0gd; mso-para-margin-left: 0cm; mso-char-indent-count: 2.0"></p>
<p></p>
<p class="MsoPlainText" style="margin: 6pt 0cm 12pt; text-indent: 21pt; line-height: 150%; mso-para-margin-top: .5gd; mso-para-margin-right: 0cm; mso-para-margin-bottom: 1.0gd; mso-para-margin-left: 0cm; mso-char-indent-count: 2.0"><font size="3"><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">一个正四面体的一次滚动显然有</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">3</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">个方向可以选择：向左（</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">L</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">）、向</span><v:shapetype id="_x0000_t202" path="m,l,21600r21600,l21600,xe" o:spt="202" coordsize="21600,21600"> <v:stroke joinstyle="miter"></v:stroke><v:path o:connecttype="rect" gradientshapeok="t"></v:path></v:shapetype></font><v:shape id="_x0000_s1026" stroked="f" type="#_x0000_t202" style="margin-top: 61143.9pt; z-index: 1; left: 0px; margin-left: 134217.727pt; width: 1in; text-indent: 0px; position: absolute; height: 12pt; text-align: left; mso-position-horizontal-relative: text; mso-position-vertical-relative: text"><v:textbox inset="0,0,0,0" style="mso-next-textbox: #_x0000_s1026; mso-fit-shape-to-text: t">
<table cellspacing="0" cellpadding="0" width="100%">
    <tbody>
        <tr>
            <td style="border-right: #ece9d8; border-top: #ece9d8; border-left: #ece9d8; border-bottom: #ece9d8; background-color: transparent">
            <div>
            <p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="mso-bidi-font-size: 10.5pt"><o:p><font face="Times New Roman" size="3">&nbsp;</font></o:p></span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
</v:textbox><w:wrap type="" side=""></w:wrap></v:shape><v:shape id="_x0000_s1027" stroked="f" type="#_x0000_t202" style="margin-top: 61143.9pt; z-index: 2; left: 0px; margin-left: 134217.727pt; width: 1in; text-indent: 0px; position: absolute; height: 12pt; text-align: left; mso-position-horizontal-relative: text; mso-position-vertical-relative: text"><v:textbox inset="0,0,0,0" style="mso-next-textbox: #_x0000_s1027; mso-fit-shape-to-text: t">
<table cellspacing="0" cellpadding="0" width="100%">
    <tbody>
        <tr>
            <td style="border-right: #ece9d8; border-top: #ece9d8; border-left: #ece9d8; border-bottom: #ece9d8; background-color: transparent">
            <div>
            <p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="mso-bidi-font-size: 10.5pt"><o:p><font face="Times New Roman" size="3">&nbsp;</font></o:p></span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
</v:textbox><w:wrap type="" side=""></w:wrap></v:shape><v:shape id="_x0000_s1028" stroked="f" type="#_x0000_t202" style="margin-top: 61143.9pt; z-index: 3; left: 0px; margin-left: 134217.727pt; width: 1in; text-indent: 0px; position: absolute; height: 12pt; text-align: left; mso-position-horizontal-relative: text; mso-position-vertical-relative: text"><v:textbox inset="0,0,0,0" style="mso-next-textbox: #_x0000_s1028; mso-fit-shape-to-text: t">
<table cellspacing="0" cellpadding="0" width="100%">
    <tbody>
        <tr>
            <td style="border-right: #ece9d8; border-top: #ece9d8; border-left: #ece9d8; border-bottom: #ece9d8; background-color: transparent">
            <div>
            <p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="mso-bidi-font-size: 10.5pt"><o:p><font face="Times New Roman" size="3">&nbsp;</font></o:p></span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
</v:textbox><w:wrap type="" side=""></w:wrap></v:shape><v:shape id="_x0000_s1029" stroked="f" type="#_x0000_t202" style="margin-top: 61143.9pt; z-index: 4; left: 0px; margin-left: 134217.727pt; width: 1in; text-indent: 0px; position: absolute; height: 12pt; text-align: left; mso-position-horizontal-relative: text; mso-position-vertical-relative: text"><v:textbox inset="0,0,0,0" style="mso-next-textbox: #_x0000_s1029; mso-fit-shape-to-text: t">
<table cellspacing="0" cellpadding="0" width="100%">
    <tbody>
        <tr>
            <td style="border-right: #ece9d8; border-top: #ece9d8; border-left: #ece9d8; border-bottom: #ece9d8; background-color: transparent">
            <div>
            <p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font face="Times New Roman" size="3">&nbsp;</font></o:p></span></p>
            </div>
            </td>
        </tr>
    </tbody>
</table>
</v:textbox><w:wrap type="" side=""></w:wrap></v:shape><font size="3"><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">右（</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">R</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">）、向后（</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">B</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">）。如</span>图 <span lang="EN-US" style="mso-no-proof: yes">4</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">所示：</span></font></p>
<p class="MsoPlainText" style="margin: 6pt 0cm 12pt; text-indent: 21pt; line-height: 150%; mso-para-margin-top: .5gd; mso-para-margin-right: 0cm; mso-para-margin-bottom: 1.0gd; mso-para-margin-left: 0cm; mso-char-indent-count: 2.0"><font size="3"><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><img alt="" src="/JudgeOnline/upload/201111/2(4).jpg" /></span></font></p></div><h2>Input</h2><div class=content><p class="MsoPlainText" style="margin: 6pt 0cm 12pt; text-indent: 21pt; line-height: 150%; mso-para-margin-top: .5gd; mso-para-margin-right: 0cm; mso-para-margin-bottom: 1.0gd; mso-para-margin-left: 0cm; mso-char-indent-count: 2.0"><font size="3"><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">输入文件的第一行是一个整数</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">n</span><font face="宋体"><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">，表示指令串中包含的指令条数。</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;"><o:p></o:p></span></font></font></p>
<p class="MsoPlainText" style="margin: 6pt 0cm 12pt; text-indent: 21pt; line-height: 150%; mso-para-margin-top: .5gd; mso-para-margin-right: 0cm; mso-para-margin-bottom: 1.0gd; mso-para-margin-left: 0cm; mso-char-indent-count: 2.0"><font size="3"><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">输入文件的第二行是一个字符串，共包含</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">n</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">个字符，每个字符是&ldquo;</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">L</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">&rdquo;&ldquo;</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">R</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">&rdquo;&ldquo;</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">B</span><font face="宋体"><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">&rdquo;之一，表示初始的指令串。</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;"><o:p></o:p></span></font></font></p>
<p class="MsoPlainText" style="margin: 6pt 0cm 12pt; text-indent: 21pt; line-height: 150%; mso-para-margin-top: .5gd; mso-para-margin-right: 0cm; mso-para-margin-bottom: 1.0gd; mso-para-margin-left: 0cm; mso-char-indent-count: 2.0"><font size="3"><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">输入文件的第三行是一个整数</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">m</span><font face="宋体"><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">，表示你的程序需要处理的操作总数。</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;"><o:p></o:p></span></font></font></p>
<p class="MsoPlainText" style="margin: 6pt 0cm 12pt; text-indent: 21pt; line-height: 150%; mso-para-margin-top: .5gd; mso-para-margin-right: 0cm; mso-para-margin-bottom: 1.0gd; mso-para-margin-left: 0cm; mso-char-indent-count: 2.0"><font size="3"><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">接下去</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">m</span><font face="宋体"><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">行，每行描述一个操作，为以下两种格式之一：</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;"><o:p></o:p></span></font></font></p>
<p class="MsoPlainText" style="margin: 6pt 0cm 12pt 64.5pt; text-indent: -36pt; line-height: 150%; mso-para-margin-top: .5gd; mso-para-margin-right: 0cm; mso-para-margin-bottom: 1.0gd; mso-para-margin-left: 64.5pt; mso-list: l0 level1 lfo1; tab-stops: list 64.5pt"><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;; mso-fareast-font-family: 'Times New Roman'"><span style="mso-list: Ignore"><font size="3">(1)</font><span style="font: 7pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><font size="3"><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">0 i c</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">：表示把第</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">i</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">个操作改成</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">c</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">，</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">c</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">为&ldquo;</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">L</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">&rdquo;&ldquo;</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">R</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">&rdquo;&ldquo;</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">B</span><font face="宋体"><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">&rdquo;之一</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;"><o:p></o:p></span></font></font></p>
<p class="MsoPlainText" style="margin: 6pt 0cm 12pt 64.5pt; text-indent: -36pt; line-height: 150%; mso-para-margin-top: .5gd; mso-para-margin-right: 0cm; mso-para-margin-bottom: 1.0gd; mso-para-margin-left: 64.5pt; mso-list: l0 level1 lfo1; tab-stops: list 64.5pt"><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;; mso-fareast-font-family: 'Times New Roman'"><span style="mso-list: Ignore"><font size="3">(2)</font><span style="font: 7pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><font size="3"><st1:chmetcnv w:st="on" unitname="l" sourcevalue="1" hasspace="True" negative="False" numbertype="1" tcsc="0"><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">1 L</span></st1:chmetcnv><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;"> R</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">：表示询问第</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">L</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">秒到第</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">R</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">秒内，</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">A</span><font face="宋体"><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">面有多少秒朝下</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;"><o:p></o:p></span></font></font></p>
<p class="MsoPlainText" style="margin: 6pt 0cm 12pt; text-indent: 21pt; line-height: 150%; mso-para-margin-top: .5gd; mso-para-margin-right: 0cm; mso-para-margin-bottom: 1.0gd; mso-para-margin-left: 0cm; mso-char-indent-count: 2.0"><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体" size="3">输入文件保证：<span lang="EN-US" style="font-size: 10.5pt; font-family: &quot;Times New Roman&quot;; mso-fareast-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">1&lt;=i&lt;=N,1&lt;=L&lt;=R&lt;=N+1</span></font></span></p></div><h2>Output</h2><div class=content><p class="MsoPlainText" style="margin: 6pt 0cm 12pt; text-indent: 21pt; line-height: 150%; mso-para-margin-top: .5gd; mso-para-margin-right: 0cm; mso-para-margin-bottom: 1.0gd; mso-para-margin-left: 0cm; mso-char-indent-count: 2.0"><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体" size="3">输出文件对于每一个询问操作依次输出你的程序给出的回答，每个回答为一个整数，占一行。</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;"><o:p></o:p></span></p></div><h2>Sample Input</h2>
			<div class=content><span class=sampledata>5<br />
LLLLB<br />
3<br />
1 3 6<br />
0 3 R<br />
1 3 6<br />
</span></div><h2>Sample Output</h2>
			<div class=content><span class=sampledata>2<br />
1<br />
</span></div><h2>HINT</h2>
			<div class=content><p><p class="MsoPlainText" style="margin: 6pt 0cm 12pt; text-indent: 21pt; line-height: 150%; mso-para-margin-top: .5gd; mso-para-margin-right: 0cm; mso-para-margin-bottom: 1.0gd; mso-para-margin-left: 0cm; mso-char-indent-count: 2.0"><font size="3"><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">第</font></span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">1</span><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><font face="宋体">个样例就是问题描述中的例子</font></span></font></p><br />
<p></p><br />
<p></p><br />
<p></p><br />
<p class="MsoPlainText" style="margin: 0cm 0cm 0pt; text-indent: 28.5pt; line-height: 150%"><span lang="EN-US">1&lt;=N&lt;=60000,1&lt;=m&lt;=150000</span></p></p></div><h2>Source</h2>
			<div class=content><p><a href='problemset.html?search=Day1'>Day1</a></p></div><center>[<a href='submitpage.php?id=2518'>Submit</a>][<a href='problemstatus.php?id=2518'>Status</a>][<a href='bbs.php?id=2518'>Discuss</a>]</center>﻿<br>

<a href="./"><span class=red>HOME</span></a>
<a href="javascript:history.go(-1)"><span class=red>Back</span></a>

<hr>
<center>
	<div class="footer">
			<a href=setlang.php?lang=ko>한국어</a>&nbsp;
		<a href=setlang.php?lang=cn>中文</a>&nbsp;
		<a href=setlang.php?lang=fa>فارسی</a>&nbsp;
		<a href=setlang.php?lang=en>English</a>&nbsp;
		<a href=setlang.php?lang=th>ไทย</a>
	<br>		<div>版权所有 &copy;2008-2012 WaterPark Organization. | <script src="http://s21.cnzz.com/stat.php?id=2982771&web_id=2982771" language="JavaScript"></script>
</div>
		<div>Based on opensource project <a href="http://hustoj.googlecode.com">hustoj</a>.</div>
	</div>
</center>
</body>
</html>
